package com.zhuss.team.processor;

import com.zhuss.team.db.dao.ext.InvestQuestionDao;
import com.zhuss.team.db.entity.InvestQuestion;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.ArrayList;
import java.util.List;

/**
 * @Author: zhushanshuo
 * @Date: 2020/3/26 13:25
 */
@Component("investQuestionRead")
public class InvestQuestionRead {

    @Autowired
    private InvestQuestionDao investQuestionDao;

    /**
     * 根据问卷id查询问题列表
     * @param investId
     * @return
     */
    public Object listQuestionId(Long investId) {
        List<InvestQuestion> list = investQuestionDao.listQuestion(investId);
        List<Long> questionIdList = new ArrayList<Long>();
        transfer(list, questionIdList);
        return questionIdList;
    }

    private void transfer(List<InvestQuestion> list, List<Long> questionIdList) {
        for (InvestQuestion item : list) {
            questionIdList.add(item.getQuestionId());
        }
    }
}
